home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / bitlin / getfile.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-23  |  8.8 KB  |  317 lines

  1. VERSION 2.00
  2. Begin Form frmGetFile 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Select a file"
  5.    Height          =   4575
  6.    Left            =   2325
  7.    LinkTopic       =   "Form1"
  8.    ScaleHeight     =   4170
  9.    ScaleWidth      =   6225
  10.    Top             =   1095
  11.    Width           =   6345
  12.    Begin TextBox txtWidth 
  13.       Height          =   285
  14.       Left            =   5520
  15.       TabIndex        =   17
  16.       Top             =   1800
  17.       Width           =   615
  18.    End
  19.    Begin TextBox txtHeight 
  20.       Height          =   285
  21.       Left            =   5520
  22.       TabIndex        =   16
  23.       Top             =   1440
  24.       Width           =   615
  25.    End
  26.    Begin PictureBox picFile2 
  27.       Height          =   615
  28.       Left            =   6360
  29.       Picture         =   GETFILE.FRX:0000
  30.       ScaleHeight     =   585
  31.       ScaleWidth      =   465
  32.       TabIndex        =   13
  33.       Top             =   840
  34.       Width           =   495
  35.    End
  36.    Begin PictureBox PicFile1 
  37.       Height          =   615
  38.       Left            =   6360
  39.       Picture         =   GETFILE.FRX:0302
  40.       ScaleHeight     =   585
  41.       ScaleWidth      =   465
  42.       TabIndex        =   12
  43.       Top             =   120
  44.       Width           =   495
  45.    End
  46.    Begin CommandButton cmdCancel 
  47.       Cancel          =   -1  'True
  48.       Caption         =   "&Cancel"
  49.       Height          =   495
  50.       Left            =   4920
  51.       TabIndex        =   11
  52.       Top             =   720
  53.       Width           =   1095
  54.    End
  55.    Begin CommandButton cmdOK 
  56.       Caption         =   "&OK"
  57.       Height          =   495
  58.       Left            =   4920
  59.       TabIndex        =   10
  60.       Top             =   120
  61.       Width           =   1095
  62.    End
  63.    Begin DirListBox dirDirectory 
  64.       Height          =   2280
  65.       Left            =   2640
  66.       TabIndex        =   9
  67.       Top             =   720
  68.       Width           =   2175
  69.    End
  70.    Begin DriveListBox drvDrive 
  71.       Height          =   315
  72.       Left            =   2640
  73.       TabIndex        =   5
  74.       Top             =   3600
  75.       Width           =   2295
  76.    End
  77.    Begin ComboBox cboFileType 
  78.       Height          =   300
  79.       Left            =   240
  80.       Style           =   2  '
  81.       TabIndex        =   4
  82.       Top             =   3600
  83.       Width           =   2175
  84.    End
  85.    Begin FileListBox filFiles 
  86.       Height          =   2370
  87.       Hidden          =   -1  'True
  88.       Left            =   240
  89.       TabIndex        =   2
  90.       Top             =   720
  91.       Width           =   2175
  92.    End
  93.    Begin TextBox txtFileName 
  94.       Height          =   285
  95.       Left            =   240
  96.       TabIndex        =   1
  97.       Top             =   360
  98.       Width           =   2175
  99.    End
  100.    Begin Label lblWidth 
  101.       Caption         =   "Width:"
  102.       Height          =   255
  103.       Left            =   4920
  104.       TabIndex        =   15
  105.       Top             =   1800
  106.       Width           =   615
  107.    End
  108.    Begin Label lblHeight 
  109.       Caption         =   "Height:"
  110.       Height          =   255
  111.       Left            =   4920
  112.       TabIndex        =   14
  113.       Top             =   1440
  114.       Width           =   615
  115.    End
  116.    Begin Image imgSample 
  117.       BorderStyle     =   1  '
  118.       Height          =   1335
  119.       Left            =   4920
  120.       Top             =   2160
  121.       Width           =   1215
  122.    End
  123.    Begin Label lblDirName 
  124.       Height          =   255
  125.       Left            =   2640
  126.       TabIndex        =   8
  127.       Top             =   360
  128.       Width           =   1455
  129.    End
  130.    Begin Label lblDirectories 
  131.       Caption         =   "Directories:"
  132.       Height          =   255
  133.       Left            =   2640
  134.       TabIndex        =   7
  135.       Top             =   120
  136.       Width           =   975
  137.    End
  138.    Begin Label lbDrive 
  139.       Caption         =   "Drive:"
  140.       Height          =   255
  141.       Left            =   2640
  142.       TabIndex        =   6
  143.       Top             =   3360
  144.       Width           =   975
  145.    End
  146.    Begin Label lblFileType 
  147.       Caption         =   "File Type:"
  148.       Height          =   255
  149.       Left            =   240
  150.       TabIndex        =   3
  151.       Top             =   3360
  152.       Width           =   735
  153.    End
  154.    Begin Label lblFileName 
  155.       Caption         =   "File Name:"
  156.       Height          =   255
  157.       Left            =   240
  158.       TabIndex        =   0
  159.       Top             =   120
  160.       Width           =   855
  161.    End
  162. Dim LZHstatus
  163. Dim LZHname
  164. Sub cboFileType_Click ()
  165. Dim patternpos1 As Integer
  166. Dim patternpos2 As Integer
  167. Dim patternlen As Integer
  168. Dim Pattern As String
  169. 'Find starting position
  170. patternpos1 = InStr(1, cbofiletype.Text, "(") + 1
  171. 'Find the end position
  172. patternpos2 = InStr(1, cbofiletype.Text, ")") - 1
  173. 'Calculate the length of the pattern string
  174. patternlen = patternpos2 - patternpos1 + 1
  175. 'Extract the pattern from the combo box
  176. Pattern = Mid$(cbofiletype.Text, patternpos1, patternlen)
  177. 'set the pattern of the filfiles to the select pattern
  178. filFiles.Pattern = Pattern
  179. End Sub
  180. Sub cmdCancel_Click ()
  181. 'Set the frmgetfile.tag to null
  182. frmGetFile.Tag = ""
  183. 'Hide the frmgetfile
  184. frmlha.Hide
  185. frmGetFile.Hide
  186. End Sub
  187. Sub cmdDelete_Click ()
  188. If txtFileName.Text = "" Then
  189.   Exit Sub
  190. End If
  191. 'Insert drive and path name
  192. procInsPath
  193. 'Delete file
  194. Kill frmGetFile.Tag
  195. txtFileName.Text = ""
  196. 'Update file list
  197. filFiles.Refresh
  198. End Sub
  199. Sub cmdDelete_DragDrop (Source As Control, X As Single, Y As Single)
  200. cmdDelete_Click
  201. End Sub
  202. Sub cmdDelete_DragOver (Source As Control, X As Single, Y As Single, state As Integer)
  203. Select Case state
  204.   Case 0
  205.     'change icon to release
  206.      filFiles.DragIcon = picFile2
  207.   Case 1
  208.     'change icon to release
  209.      filFiles.DragIcon = picFile1
  210. End Select
  211. End Sub
  212. Sub cmdOK_Click ()
  213. Dim pathandname As String
  214. Dim Path
  215. 'if no file is selected, exit this procedure
  216. If txtFileName.Text = "" Then
  217.   Exit Sub
  218. End If
  219. 'Insert path name
  220. procInsPath
  221. 'Hide frmgetfile
  222. frmGetFile.Hide
  223. End Sub
  224. Sub dirDirectory_Change ()
  225. 'Change the path of the file list box
  226. filFiles.Path = dirDirectory.Path
  227. 'Update lblDirName
  228. lblDirName.Caption = dirDirectory.Path
  229. End Sub
  230. Sub dirDirectory_KeyPress (KeyAscii As Integer)
  231. If KeyAscii = 13 Then
  232.  'Change path
  233.  dirDirectory.Path = dirDirectory.List(dirDirectory.ListIndex)
  234. End If
  235. End Sub
  236. Sub DisplaySample ()
  237. 'Insert full path
  238. procInsPath
  239. 'Display picture
  240. imgSample.Picture = LoadPicture(frmGetFile.Tag)
  241. 'Display size
  242. txtWidth.Text = imgSample.Width / screen.TwipsPerPixelX
  243. txtHeight.Text = imgSample.Height / screen.TwipsPerPixelY
  244. 'if BMP too large then cut it off
  245. If imgSample.Width > 1215 Then
  246.   imgSample.Width = 1215
  247.   txtWidth.Text = txtWidth.Text + "+"
  248. End If
  249. If imgSample.Height > 1335 Then
  250.   imgSample.Height = 1335
  251.   txtHeight.Text = txtHeight.Text + "+"
  252. End If
  253. End Sub
  254. Sub drvDrive_Change ()
  255. 'Set Error trap
  256. On Error GoTo DriveError
  257. 'Change the path of the directory list box to new drive
  258. dirDirectory.Path = drvDrive.Drive
  259. Exit Sub
  260. 'Error routine
  261. DriveError:
  262. 'Restore to the original drive
  263. MsgBox "Drive error!", 48, "Error"
  264. drvDrive.Drive = dirDirectory.Path
  265. Exit Sub
  266. End Sub
  267. Sub filFiles_Click ()
  268. 'Update the txtFileName text box
  269. txtFileName = filFiles.FileName
  270. End Sub
  271. 'Copyright 1995  by Hitoshi Ozawa
  272. Sub filFiles_DblClick ()
  273. 'If it is a LHA file, open frmlha
  274. If Right$(filFiles.FileName, 3) = "lzh" Then
  275.  'Save file name in fname variable
  276.  procInsPath
  277.  frmlha.Show 1
  278.  filFiles.FileName = frmlha.Tag
  279.  Exit Sub
  280. End If
  281. 'Update the txtfilename text box with selected file name
  282. txtFileName = filFiles.FileName
  283. 'Display BMP file in imgSample
  284. DisplaySample
  285. End Sub
  286. Sub filFiles_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  287. 'Change drag icon
  288. filFiles.DragIcon = picFile1
  289. 'Enable drag
  290. filFiles.Drag
  291. End Sub
  292. Sub Form_Load ()
  293. 'Update the Directory lblDir Name with the path of directory list box
  294. lblDirName.Caption = dirDirectory.Path
  295. End Sub
  296. Sub imgSample_DragDrop (Source As Control, X As Single, Y As Single)
  297. DisplaySample
  298. End Sub
  299. Sub imgSample_DragOver (Source As Control, X As Single, Y As Single, state As Integer)
  300. Select Case state
  301.   Case 0
  302.     'change icon when over
  303.     filFiles.DragIcon = picFile2
  304.   Case 1
  305.     'change icon to release
  306.     filFiles.DragIcon = picFile1
  307. End Select
  308. End Sub
  309. Sub txtFileName_KeyPress (KeyAscii As Integer)
  310. If KeyAscii = 13 Then
  311.   If (InStr(txtFileName.Text, "*") <> 0) Or (InStr(txtFileName.Text, "?") <> 0) Then
  312.     'set the pattern of the filfiles to the select pattern
  313.     filFiles.Pattern = txtFileName.Text
  314.   End If
  315. End If
  316. End Sub
  317.